using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.IO;
using System.Reflection;
using System.Text;
using System.Windows.Forms;

namespace Universe.WinForms.Test
{
    public partial class Form2 
    {
        public static Form BuildSplashForm()
        {
            using (Stream s = Assembly.GetExecutingAssembly().GetManifestResourceStream(typeof(Form2), "Splash.gif"))
            {
                Bitmap bmp = new Bitmap(s);
                Rectangle rect = new Rectangle(0, 0, bmp.Width, bmp.Height);
                Form splash = new Form();
                splash.StartPosition = FormStartPosition.CenterScreen;
                splash.Size = rect.Size;
                splash.BackgroundImage = bmp;
                splash.BackgroundImageLayout = ImageLayout.Center;
                // splash.Text = string.Empty;
                splash.FormBorderStyle = FormBorderStyle.None;
                splash.ShowInTaskbar = false;

                ContinualColorPath cp = new ContinualColorPath(bmp, new Point(0, 0));
                GraphicsPath transPath = cp.GraphicsPath;
                object oo = cp.GraphicsPath;
                Region all = new Region(rect);
                all.Exclude(transPath);

                splash.Region = all;
                splash.TopMost = true;

                splash.Show();
                Application.DoEvents();

                return splash;
            }
        }
    }
}